﻿using BabyToys.Models;
using BabyToys.Models.ViewModel;
using Mvc.Mailer;
using System.Text;

namespace BabyToys.Mailers
{ 
    public class UserMailer : MailerBase, IUserMailer 	
	{
		public UserMailer()
		{
			MasterName="_Layout";
		}
		
		public virtual MvcMailMessage Welcome()
		{
			//ViewBag.Data = someObject;
			return Populate(x =>
			{
				x.Subject = "Welcome";
				x.ViewName = "Welcome";
				x.To.Add("lenhutthanhquang@gmail.com");
			});
		}
        public virtual MvcMailMessage SendOrder()
        {
            //ViewBag.Data = someObject;
            return Populate(x =>
            {
                x.Subject = "Welcome";
                x.ViewName = "Welcome";
                x.To.Add("lenhutthanhquang@gmail.com");
            });
        }
		public virtual MvcMailMessage PasswordReset(string email,string password)
		{
			//ViewBag.Data = someObject;
            var mailMessage = new MvcMailMessage { Subject = "Đổi mật khẩu" };
            mailMessage.BodyEncoding = Encoding.UTF8;
            mailMessage.To.Add(email);
            ViewBag.password = password;
            PopulateBody(mailMessage, viewName: "PasswordReset");
            return mailMessage;
		}
 
		public virtual MvcMailMessage Order(HoaDon hoadon,string email)
		{
            var mailMessage = new MvcMailMessage { Subject = "Xác nhận đơn hàng" };
            mailMessage.BodyEncoding = Encoding.UTF8;
            mailMessage.To.Add(email);
            ViewData = new System.Web.Mvc.ViewDataDictionary(hoadon);
            PopulateBody(mailMessage, viewName: "Order");
            return mailMessage;
		}
 	}
}